<?php

namespace common\models;

use Yii;
use \common\models\base\Dictionary as BaseDictionary;

/**
 * This is the model class for table "dictionary".
 */
class Dictionary extends BaseDictionary
{
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return array_replace_recursive(parent::rules(),
	    [
            [['code', 'value'], 'required'],
            [['order_num', 'level'], 'integer'],
            [['code', 'parent_id'], 'string', 'max' => 32],
            [['value'], 'string', 'max' => 50],
            [['label'], 'string', 'max' => 200],
            [['mnemonic'], 'string', 'max' => 45]
        ]);
    }

    public static function getCordLength()
    {
        $length = self::findOne(['code'=>'cord_length']);
        return $length->value;
    }
	
}
